﻿<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>显示销售订单</title>
    <link rel="stylesheet" href="<%=basePath%>web/css/from.css">
    <link rel="stylesheet" href="<%=basePath%>web/themes/default/easyui.css">
    <link rel="stylesheet" href="<%=basePath%>web/themes/icon.css">
    <script src="<%=basePath%>web/js/jquery.min.js"></script>
    <script src="<%=basePath%>web/js/jquery.easyui.min.js"></script>
    <script src="<%=basePath%>web/js/easyui-lang-zh_CN.js"></script>
    <script>
        function loadSupplier() {
            $("#list").dialog({
                title: '选择客户',
                width: 905,
                height: 400,
                closed: false,
                cache: false,
                modal: true,
           })    
        }
        function closeDg(name) {
            $("#supplierName").val(name);
            $("#list").dialog("close");
        }
        
         function loadPart() {
            $("#partList").dialog({
                title: '选择配件',
                width: 1000,
                height: 400,
                closed: false,
                cache: false,
                modal: true,
           })
        }
        function closePart() {
            $("#partList").dialog("close");
        }
        
        $(function(){
        var sellcode=$("#sellcode").val();
            $("#generatingParts").datagrid({
                url:'/kxmanage/sellorderbill/findpartsbysellcode?sellcode='+sellcode,
                checkOnSelect:true,
                rownumbers:true,
                columns:[[
                    {field:'code',title:'配件编号',width:130},
                    {field:'partName',title:'配件名称',width:160},
                    {field:'partBrand',title:'配件品牌',width:120},
                    {field:'partNo',title:'配件型号',width:100},
                    {field:'amount',title:'数量',width:100},
                    {field:'sellPrice',title:'单价',width:100, 
                        formatter:function(value,row,index){
                        if(row.sellPrice==null){
                    		return null;
                    	}
                            return "￥"+row.sellPrice;
                        }
                    },
                    {field:'price',title:'总金额',width:100,
                         formatter:function(value,row,index){
                            return "￥"+row.price;
                        }
                    },
                    {field:'memo',title:'备注',width:210},
                    {field:'opt',title:'操作',width:100,formatter:function (value,row,index) {
                        if(row.sellPrice==null){
                    		return null;
                    	}
                            var context="<a style='opacity: 0.2' href=\"javascript:detail('"+row.code+"')\">删除</a>&nbsp;&nbsp;" 
                            return context;
                        }}

                ]],
                toolbar:'#wu_toolbar',
                onLoadSuccess:function(){
                	$("#generatingParts").datagrid('appendRow',{
                	  'partBrand':"合计",
                	  'amount':total('amount'),
                	  'price':total('price')
                    })
                }
            })
        })
        
        function total(col){
        	var rows=$("#generatingParts").datagrid('getRows');
        	var total=0;
        	for(var i=0;i<rows.length;i++){
        		total+=parseFloat(rows[i][col]);
        	}
        	return total;
        }
        
        function add(){
           parent.addTabs("销售订单","/kxmanage/web/goods/addSalesOrder.jsp");
        }  
        
        function Close(){
            parent.closeTabs("销售订单");
        }
        
         function Revoke(){
            $.messager.confirm('确认','确认想要撤销该销售单吗？',function(r){
              if (r==true){
                var sellcode=$("#sellcode").val();
                location.href="/kxmanage/sellorderbill/Revoke?sellcode="+sellcode;
              }
            });  
         }
           
    </script>
    <style>
        body {
            font-size:12px;
            padding:10px
        }
        .l-table-edit {
          border-collapse:collapse;
          border-spacing:0;
        }
        .l-table-edit-td {
            padding:4px;
            font-size:12px;
            border:1px solid #84a0c4 
        }
        
    </style>


</head>
<body>
<form name="form"  id="form" action="" method="post">
    <table cellpadding="0" cellspacing="0" class="l-table-edit" style="width:100%" border="1" >
        <tr >
            <td width="17%"  align="right" class="l-table-edit-td">订单编号：</td>
            <td width="27%" align="left" class="l-table-edit-td"><input  type="text" readonly="readonly" class="easyui-textbox" id="code" value="${sellOrderBill.code}" readonly  maxlength="100" ltype="text" style="height:20px" /></td>
            <td width="13%"  align="right" class="l-table-edit-td">订单日期：</td>
            <td width="43%" align="left" class="l-table-edit-td"><input  type="text" id="addDate" readonly="readonly" value="<fmt:formatDate value="${sellOrderBill.orderTime }" pattern="yyyy-MM-dd hh:mm:ss"/>" maxlength="30" class="easyui-datetimebox" style="height:20px"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">
                <a href="javascript:;">客户名称：</a>
            </td>
            <td align="left" class="l-table-edit-td" width="27%">
                <input type="text" id="supplierName"  value="${sellOrderBill.customName}" readonly="readonly" class="easyui-textbox"  maxlength="100" ltype="text"  style="height:20px"/>
            <td width="13%" align="right" class="l-table-edit-td">联系人员：</td>
            <td align="left" class="l-table-edit-td" width="43%">
                <input name="linkman" type="text" id="contacter" value="${sellOrderBill.linkman}" class="easyui-textbox" readonly="readonly" maxlength="30" ltype="text" style="height:20px"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">电话：</td>
            <td width="27%" align="left" class="l-table-edit-td"><input  type="text" id="type"class="easyui-textbox" value="${sellOrderBill.phone }" readonly="readonly" maxlength="50" ltype="text" style="height:20px"/></td>
            <td width="13%" align="right" class="l-table-edit-td">传真：</td>
            <td width="43%" align="left" class="l-table-edit-td"><input type="text" id="fax" class="easyui-textbox" value="${sellOrderBill.fax }" maxlength="50" readonly="readonly" ltype="text" style="height:20px"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">运输方式：</td>
            <td width="27%" align="left" class="l-table-edit-td">
             <select name="shippingMode" id="shippingMode"  class="easyui-combobox" style="width:100px;height:20px" disabled="disabled" panelHeight="150px">
                 <option value="1" <c:if test="${sellOrderBill.shippingMode==1}">selected</c:if>>圆通快递</option> 
                 <option value="2" <c:if test="${sellOrderBill.shippingMode==2}">selected</c:if>>中通快递</option> 
             </select>
            </td>
            <td width="13%" align="right" class="l-table-edit-td">业务人员：</td>
            <td width="43%"align="left" class="l-table-edit-td"><input type="text"  class="easyui-textbox" readonly="readonly" id="fax" value="ziji" maxlength="50"  ltype="text" style="height:20px"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">备注：</td>
            <td width="27%" align="left" class="l-table-edit-td"><input  type="text" name="memo" readonly="readonly" class="easyui-textbox" id="type" value="${sellOrderBill.memo}" maxlength="50" ltype="text" style="height:20px"/></td>
            <td width="13%" align="right" class="l-table-edit-td">交货日期：</td>
            <td width="43%" align="left" class="l-table-edit-td"><input type="text"  name="deliveryTime" readonly="readonly" class="easyui-datetimebox" id="fax" value="<fmt:formatDate value="${sellOrderBill.deliveryTime }" pattern="yyyy-MM-dd hh:mm:ss"/>" maxlength="50"  ltype="text" style="height:20px"/></td>
        </tr>
    </table>
</form>
<br>
<input type="hidden" id="sellcode" value="${sellOrderBill.code}"/>
<input type="hidden" id="path" value="${pageContext.request.contextPath}"/>
<input  type="button" onclick="add()" value="新   增" style="width:60px">
<input  type="button" value="选详情单" style="width:60px" disabled="disabled">
<a href="javascript:loadPart()"><input  type="button" disabled="disabled" value="添加配件" style="width:60px"></a>
<input  type="button" value="保存" style="width:60px" disabled="disabled">
<input  type="button" value="审核" style="width:60px" disabled="disabled">
<input  type="button" id="chexiao" onclick="Revoke()"value="撤销" style="width:60px">
<input  type="button" onclick="Close()" value="关闭" style="width:60px">
<br/><br/>
<div id="generatingParts" class="easyui-datagrid">
</div>
<div id="list"  style="display: none">
    <iframe src='<%=basePath%>web/goods/supplier_list.jsp' frameborder='0'style='width: 100%;height: 100%'></iframe>
</div>
<div id="partList"  style="display: none">
    <iframe src='<%=basePath%>web/goods/addPart.jsp' frameborder='0'style='width: 100%;height: 100%'></iframe>
</div>
</body>
</html>